/**
 * class name: mask$,
 * copyright: maximus zhang,
 * License: MIT-LICENSE,
 * contact: maximus.zhang@gmail.com,
 * required-js: http://hcjs.googlecode.com/svn/trunk/hc.js,
 * update: http://hcjs.googlecode.com/svn/trunk/mask.js
 *
 */
function mask$(){
    var A = arguments,
        _ = this;
    _ = ext$( _, ext$( {elem:'', id:'z-masker', opacity:50, color:'#fff'}, A[0] ) );
    _.uitype = 'mask$';
    _.z = now$().getFullYear()-1;
    _.css = 'position:fixed;top:0;left:0;width:100%;height:100%;border:0;'
        + ($$.msie  ? 'filter:alpha(opacity='+ _.opacity +');'
                    : 'opacity:'+ _.opacity/100 +';')
        +'z-index:'+ _.z +';background-color:'+ _.color +';display:none;';
}
mask$.prototype = {
    init$ : function(){
        this.$ = $(this.id) || el$('div').before$(me.body.childNodes[0]);
        this.$.style.cssText = this.css;
        this.$.id = this.id;

        this.$.ondblclick = function(){
            return false;
        };

        if ( $$.msie && $$.version<7.0 ) {//todo:for ie6
            this.$.style.position = 'absolute';
            this.$.innerHTML = '<iframe scrolling="no" frameborder="0" style="position:absolute;top:0;left:0;width:100%;height:100%;filter:alpha(opacity=0);z-index:-1;"></iframe>';

            this._ = el$('div').appendTo$(this.$);
            this._.style.cssText = this.css;
        }
    return this;
    },

    maskit$ : function(obj){
        this.elem = $(obj) || $(this.elem);
        if ( this.elem.nodeType ) {
            var pz = pos$(this.elem);
            with ( this.$.style ) {
                position = 'absolute';
                top = pz.top +'px';
                left = pz.left +'px';
                width = pz.width +'px';
                height = pz.height +'px';
            }
        }
    return this;
    },

    color$ : function(c){
        this.color = c || this.color;
        this.$.style.backgroundColor = this.color;
    return this;
    },

    opacity$ : function(x){
        this.opacity = x || this.opacity;
        with (this.$.style) {
            $$.msie ? filter = 'alpha(opacity='+ this.opacity +')'
                    : opacity = this.opacity/100;
        }
    return this;
    },

    on$ : function(){
        this.$.style.display = '';
    return this;
    },

    off$ : function(){
        this.$.style.display = 'none';
    return this;
    }

};
